package com.bw.mvvm_common.network.inteceptor;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * @author KK
 * @description:
 * @date :2021/10/13 15:33
 */
public class ErroInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        Response response = chain.proceed(request);
        if (response.code() == 200)
            return  response;
        Response.Builder builder = new Response.Builder();
        builder.code(200);
        builder.headers(response.headers());
        builder.message(response.message());
        builder.protocol(response.protocol());
        builder.body(response.body());
        return builder.build();

    }
}
